Voorbeeld van de instructie Print #

Dit voorbeeld maakt gebruik van de instructie Print # om gegevens naar een bestand te schrijven.

Open "TESTBSTD" For Output As #1    ' Open file for output.
Print #1, "Dit is een test"    ' Print text to file.
Print #1,    ' Print blank line to file.
Print #1, "Zone 1"; Tab ; "Zone 2"    ' Print in two print zones.
Print #1, "Hallo" ; " " ; "allemaal"    ' Separate strings with space.
Print #1, Spc(5) ; "5 leading spaces "    ' Print five leading spaces.
Print #1, Tab(10) ; "Hallo"    ' Print word at column 10.

' Assign Boolean, Date, Null and Error values.
Dim MyBool, MyDate, MyNull, MyError
MyBool = False : MyDate = #12 februari 1969# : MyNull = Null
MyError = CVErr(32767)
' True, False, Null, and Error are translated using locale settings of
' your system. Date literals are written using standard short date
' format.
Print #1, MyBool ; " is een Boole-waarde"
Print #1, MyDate ; " is een datum"
Print #1, MyNull ; " is een Null-waarde"
Print #1, MyError ; " is een foutwaarde"
Close #1    ' Close file.